From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0002.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0002.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0003.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0003.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0004.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0004.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0005.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0005.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0006.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0006.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0007.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0007.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0008.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0008.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0009.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0009.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0010.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0010.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0011.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0011.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0012.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0012.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0013.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0013.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0014.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0014.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0015.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0015.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0016.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0016.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0017.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0017.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0018.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0018.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0019.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0019.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0020.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0020.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0021.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0021.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0022.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0022.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0023.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0023.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0024.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0024.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0025.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0025.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0026.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0026.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0027.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0027.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0028.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0028.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0029.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0029.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0030.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0030.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0031.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0031.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0032.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0032.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0033.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0033.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0034.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0034.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0035.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0035.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0036.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0036.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0037.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0037.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0038.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0038.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0039.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0039.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0040.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0040.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0041.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0041.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0042.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0042.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0043.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0043.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0044.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0044.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0045.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0045.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0046.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0046.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0047.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0047.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0048.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0048.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0049.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0049.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0050.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0050.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0051.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0051.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0052.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0052.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0053.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0053.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0054.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0054.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0055.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0055.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0056.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0056.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0057.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0057.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0058.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0058.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0059.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0059.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0060.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0060.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0061.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0061.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0062.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0062.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0063.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0063.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0064.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0064.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0065.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0065.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0066.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0066.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0067.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0067.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0068.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0068.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0069.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0069.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0070.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0070.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0071.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0071.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0072.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0072.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0073.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0073.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0074.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0074.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0075.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0075.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0076.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0076.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0077.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0077.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0078.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0078.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0079.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0079.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0080.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0080.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0081.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0081.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0082.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0082.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0083.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0083.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0084.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0084.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0085.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0085.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0086.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0086.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0087.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0087.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0088.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0088.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0089.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0089.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0090.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0090.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0091.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0091.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0092.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0092.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0093.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0093.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0094.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0094.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0095.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0095.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0096.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0096.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0097.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0097.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0098.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0098.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0099.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0099.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0100.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0100.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0101.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0101.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0102.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0102.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0103.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0103.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0104.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0104.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0105.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0105.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0106.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0106.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0107.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0107.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0108.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0108.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0109.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0109.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0110.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0110.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0111.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0111.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0112.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0112.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0113.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0113.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0114.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0114.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0115.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0115.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0116.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0116.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0117.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0117.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0118.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0118.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0119.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0119.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0120.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0120.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0121.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0121.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0122.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0122.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0123.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0123.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0124.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0124.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0125.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0125.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0126.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0126.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0127.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0127.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0128.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0128.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0129.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0129.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0130.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0130.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0131.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0131.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0132.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0132.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0133.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0133.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0134.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0134.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0135.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0135.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0136.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0136.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0137.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0137.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0138.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0138.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0139.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0139.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0140.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0140.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0141.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0141.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0142.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0142.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0143.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0143.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0144.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0144.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0145.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0145.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0146.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0146.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0147.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0147.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0148.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0148.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0149.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0149.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0150.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0150.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0151.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0151.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0152.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0152.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0153.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0153.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0154.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0154.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0155.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0155.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0156.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0156.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0157.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0157.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0158.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0158.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0159.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0159.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0160.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0160.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0161.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0161.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0162.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0162.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0163.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0163.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0164.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0164.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0165.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0165.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0166.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0166.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0167.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0167.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0168.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0168.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0169.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0169.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0170.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0170.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0171.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0171.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0172.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0172.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0173.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0173.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0174.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0174.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0175.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0175.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0176.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0176.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0177.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0177.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0178.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0178.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0179.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0179.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0180.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0180.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0181.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0181.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0182.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0182.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0183.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0183.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0184.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0184.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0185.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0185.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0186.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0186.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0187.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0187.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0188.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0188.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0189.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0189.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0190.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0190.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0191.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0191.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0192.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0192.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0193.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0193.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0194.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0194.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0195.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0195.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0196.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0196.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0197.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0197.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0198.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0198.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0199.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0199.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > ... goes on and on. > > If I close the port in the exception handling I get only one of the above > exceptions followed by this one: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in nativeDrain > at gnu.io.RXTXPort.nativeDrain(Native Method) > at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) > at de.dsh.io.Comport.flush(Comport.java:144) > at de.dsh.io.RXTXComport.close(RXTXComport.java:170) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > > --------------------------------------------------------------------------------- > > I use my own Exception logger that logs every exception and other messages > into a file... > on the standard commandline appear some messages from the > native code: > > --------------------------------------------------------------------------------- > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): > Zugriff verweigert > > > Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. > > --------------------------------------------------------------------------------- > > "Zugriff verweigert" = German for "Access denied" > > > I cannot open any other port after this and need to close the Application. > Any other operation on the serial ports causes the Application to freeze, > which > is not that nice... > > Any ideas how to solve this problem or to detect when the port is > disconnected > (and close the port)? > I would try it myself - but I am not that deep into Win/Linux C > programming... > I use C for microcontrollers only... > > Thanks in advance and > Best regards, > Dominik S. Herwald > > http://www.dsh-elektronik.de/ Hi Dominik This is going to be a problem for more and more people. I was just getting into a new position and looking at some serial bugs. It was about day three I realized the computer didnt even have a UART :) These USB serial dongles are going to be more and more common. At least some appear to work very well. Right now, all you can do is say "Don't unplug the dongle." Thats not very clean. We could perhaps through an exception when the w32 error is shown. The real solution is probably to start listening for USB events. Thats not a small task to determine if the port is actually USB off the top of my head. I wonder if there is ever a time when you would recieve permission denied that was not the result of the 'virtual' hardware going away. You should not be able to open the port otherwise. The 'no error' message is lazy programming on my part. w32 should set the errorno but did not in that case. The 'YACK()' is printing into your logs the actual w32 API error which needs to be translated into POSIX error codes. The default is 0 which is 'no error.' So there are a few questions. Where is the native code slipping out of the normal paths upon this error? This is a bug regardless of USB/UART. Is the 'permission denied' message enough to know what happened at all times? What will happen on Unix/Linux/Mac OS X? Would it be posible to listen to USB events while still using the virtual device. or.. can you connect the dots? The errorno and incorrect code paths I can look at sooner rather than later. The other issues will take more thought and testing. From mazharmoinuddinm at danlawinc.com Thu Apr 6 22:30:29 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Fri, 7 Apr 2006 10:00:29 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604071000.30236.mazharmoinuddinm@danlawinc.com> > hi, > ??????I have downloaded ?source code for rxtx-2.1-7r2 from the site and trying to >> cross compile it for arm. I have already built the kaffe for arm. The >> configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get >> the following error. >> >> ? ? ? ? ? ? ? ? ? throw new gnu.io.PortInUseException( >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^^ >> *** Semantic Error: You need to modify your classpath, sourcepath, >> bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" >> in: >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm/jre/lib/glibj.zip >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar >> ? ? ? ? ? ? ? ?. >>? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2 >> ? ? ? ? ? ? ? ?/home/mazhar/rxtx-2.1-7r2/src >> ? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/classes.zip >>? ? ? ? ? ? ? ?/home/mazhar/kaffe-arm//lib/RXTXcomm.jar >> >> >> any help in this regard is appreciated.. >> >package gnu.io is on RXTXcomm.jar > >try jar -tf RXTXcomm.jar and you should see >gnu/io/PortInUseExecption.class > >Perhaps you need to modify your classpath? hi, thanks for the reply. The problem was that though the class path was set properly, there was a comm.jar too in the classpath that was giving the problem. Removing the commapi from sun solved the problem. thanks and regards Mazhar From chinkaiw at hotmail.com Fri Apr 7 01:58:18 2006 From: chinkaiw at hotmail.com (Wang Chinkai) Date: Fri, 07 Apr 2006 07:58:18 +0000 Subject: [Rxtx] How to implement com device plug and play? Message-ID: Hi all, I find a resource on http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD set to Mark Idle. I know how to set DTR and RTS, but do not know how to set TXD? And , did anyone implement com device plug and play? I want to find some example. Thanks. From d.herwald at onlinehome.de Fri Apr 7 07:48:33 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Fri, 07 Apr 2006 15:48:33 +0200 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: References: <443585FB.600@onlinehome.de> Message-ID: <44366DB1.5090204@onlinehome.de> > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Fri Apr 7 20:29:13 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 7 Apr 2006 20:29:13 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Wang Chinkai wrote: > Hi all, > I find a resource on > http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 > > In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD > set to Mark Idle. > > I know how to set DTR and RTS, but do not know how to set TXD? > > And , did anyone implement com device plug and play? > I want to find some example. > Thanks. > > The only Mark in rxtx is Parity. This should be supported but I do not know if it has been confirmed. I think TXD refers to the transmit wire. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Apr 8 07:25:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 8 Apr 2006 07:25:47 -0600 (MDT) Subject: [Rxtx] How to implement com device plug and play? In-Reply-To: References: Message-ID: On Fri, 7 Apr 2006, Trent Jarvi wrote: > On Fri, 7 Apr 2006, Wang Chinkai wrote: > >> Hi all, >> I find a resource on >> http://www.osdever.net/documents/PNP-ExternalSerial-v1.00.pdf?the_id=52 >> >> In page 11, it says Initialize the COM port, with DTR ON , RTS OFF, and TXD >> set to Mark Idle. >> >> I know how to set DTR and RTS, but do not know how to set TXD? >> >> And , did anyone implement com device plug and play? >> I want to find some example. >> Thanks. >> >> > > The only Mark in rxtx is Parity. This should be supported but I do not know > if it has been confirmed. > > I think TXD refers to the transmit wire. > There are more good bits here but.. http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html#anchor1178493 >> Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage). << So that should be fine by default. While idle, the line will be "Mark" which is negative voltage. You can test that with a volt meter. Just open the port and check pin 2 vs the metal on the D connector or ground (pin 5). This all assumes a db 9 pin connector and no null (crossover of pins 2 and 3) modem cable. I've seen reports of people needing to cycle DTR/RTS type settings OFF and then ON but don't understand why yet. If it does not work right away, you may try that and let us know if its true. -- Trent Jarvi tjarvi at qbang.org From mtnvega at yahoo.com.br Sun Apr 9 21:44:57 2006 From: mtnvega at yahoo.com.br (Luiz Jr) Date: Mon, 10 Apr 2006 00:44:57 -0300 (ART) Subject: [Rxtx] =?iso-8859-1?q?Serial_I=B2C?= Message-ID: <20060410034457.17801.qmail@web53510.mail.yahoo.com> Hello, I will be starting the implementation of a system where I will need to control some devices through an I?C bus. I am thinking about using the PC as a I?C bus master, so I would like to know if there is anything similar RXTX for I?C, and if yes, I would like to know more about it's performance. The other option is to use RS-232 to communicate with a PIC microcontroller and make PIC the I?C bus master instead of the PC. What do you think? Thank you, Luiz --------------------------------- Abra sua conta no Yahoo! Mail - 1GB de espa?o, alertas de e-mail no celular e anti-spam realmente eficaz. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/658c141c/attachment-0200.html From Lars.Hennig at wow-portal.com Sun Apr 9 02:44:23 2006 From: Lars.Hennig at wow-portal.com (Lars.Hennig@wow-portal.com) Date: Sun, 09 Apr 2006 08:44:23 -0000 Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <44366DB1.5090204@onlinehome.de> Message-ID: Hi, I am experiencing the same problem. It is getting even worst if you us Win2000. There the method nativeavailable() is not returning from its call. The whole application blocks in this case waiting for an answer. Any ideas what can be done to avoid this behavior? Thanks, Lars > Hi Dominik > > This is going to be a problem for more and more people. I was just > getting into a new position and looking at some serial bugs. It was > about day three I realized the computer didnt even have a UART :) > > These USB serial dongles are going to be more and more common. At > least some appear to work very well. > > Right now, all you can do is say "Don't unplug the dongle." Thats not > very clean. We could perhaps through an exception when the w32 error > is shown. The real solution is probably to start listening for USB > events. Thats not a small task to determine if the port is actually > USB off the top of my head. > > I wonder if there is ever a time when you would recieve permission > denied that was not the result of the 'virtual' hardware going away. > You should not be able to open the port otherwise. > > The 'no error' message is lazy programming on my part. w32 should set > the errorno but did not in that case. The 'YACK()' is printing into > your logs the actual w32 API error which needs to be translated into > POSIX error codes. The default is 0 which is 'no error.' > > So there are a few questions. > > Where is the native code slipping out of the normal paths upon this > error? This is a bug regardless of USB/UART. > > Is the 'permission denied' message enough to know what happened at all > times? What will happen on Unix/Linux/Mac OS X? > > Would it be posible to listen to USB events while still using the > virtual device. or.. can you connect the dots? > > The errorno and incorrect code paths I can look at sooner rather than > later. The other issues will take more thought and testing. > Hi Trent, You are right, the standard serial ports are about to be thrown away by the industry. Actually I integrate usb to serial interfaces into all my new projects because of this. (mainly based on FTDI devices, they are quite small, require few external components and fit nice on my boards) Nearly all new Notebooks and more and more Desktop PCs don't have serial and parallel ports anymore so IMHO full support for USB dongles will be required for RXTX Project in the future. RXTX works very nice with my USB interfaces - 500kBaud is no problem. (I did not test it, but it should work at up to 3MBaud) The only problem I have is this disconnection Bug... > We could perhaps through an exception when the w32 error is shown Maybe you could just do a small work around if it is possible: Well, if I restart the application everything works again... So I get the idea of maybe reload/restart the library when you get such an error? uhhm - let's better call this "reinitialize" the library to its initial state. ==> When you get such an error, just reinitialize the library (if this is possible in any way), throw an exception and allow the Java application to savely close the port and reinitialize the RXTX port stuff if required. (?) > Is the 'permission denied' message enough to know what happened at all times? > What will happen on Unix/Linux/Mac OS X? Good question. Maybe I can try it on my linux box this weekend and see what happens. But I don't have a Mac ;) For USB you could maybe have a look at http://javax-usb.org/ or http://libusb.sourceforge.net/ http://libusb-win32.sourceforge.net/ I just wanted to let you know about these libs if you don't already know them. Maybe this is too complex. > "Don't unplug the dongle." My application is already showing an error dialog, which tells the user about this problem and terminates the application... Not nice, but until you found the time to fix it - I can live with it. > The default is 0 which is 'no error.' Hehe yes - this reads a bit strange "no error in read byte" ;) At least this should be changed some day. > So there are a few questions. Well, as I told you - I am not much help with x86 C/C++ programming... Once I wrote a JNI shared object for Linux that interfaced the parallel port (simple inb outb functions) out of a Java app running on my Robots' embedded PC - that was nearly all I ever did with C on the x86 platform ;) Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20060409/e54f85b3/attachment-0200.html From mazharmoinuddinm at danlawinc.com Tue Apr 4 02:58:00 2006 From: mazharmoinuddinm at danlawinc.com (Mohd Mazhar Moinuddin) Date: Tue, 4 Apr 2006 14:28:00 +0530 Subject: [Rxtx] help reg. ..error: gnu.io package not found Message-ID: <200604041428.01116.mazharmoinuddinm@danlawinc.com> hi, I have downloaded source code for rxtx-2.1-7r2 from the site and trying to cross compile it for arm. I have already built the kaffe for arm. The configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get the following error. throw new gnu.io.PortInUseException( ^^ *** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" in: /home/mazhar/kaffe-arm/jre/lib/glibj.zip /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar . /home/mazhar/rxtx-2.1-7r2 /home/mazhar/rxtx-2.1-7r2/src /home/mazhar/kaffe-arm//lib/classes.zip /home/mazhar/kaffe-arm//lib/RXTXcomm.jar any help in this regard is appreciated.. regards Mazhar From tjarvi at qbang.org Tue Apr 4 19:22:44 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 4 Apr 2006 19:22:44 -0600 (MDT) Subject: [Rxtx] help reg. ..error: gnu.io package not found In-Reply-To: <200604041428.01116.mazharmoinuddinm@danlawinc.com> References: <200604041428.01116.mazharmoinuddinm@danlawinc.com> Message-ID: On Tue, 4 Apr 2006, Mohd Mazhar Moinuddin wrote: > hi, > I have downloaded source code for rxtx-2.1-7r2 from the site and trying to > cross compile it for arm. I have already built the kaffe for arm. The > configure script runs okay but when i do a 'make' from the rxtx-2.1-7r2 i get > the following error. > > throw new gnu.io.PortInUseException( > ^^ > *** Semantic Error: You need to modify your classpath, sourcepath, > bootclasspath, and/or extdirs setup. Jikes could not find package "gnu.io" > in: > /home/mazhar/kaffe-arm/jre/lib/glibj.zip > /home/mazhar/rxtx-2.1-7r2/RXTXcomm.jar > . > /home/mazhar/rxtx-2.1-7r2 > /home/mazhar/rxtx-2.1-7r2/src > /home/mazhar/kaffe-arm//lib/classes.zip > /home/mazhar/kaffe-arm//lib/RXTXcomm.jar > > > any help in this regard is appreciated.. > package gnu.io is on RXTXcomm.jar try jar -tf RXTXcomm.jar and you should see gnu/io/PortInUseExecption.class Perhaps you need to modify your classpath? -- Trent Jarvi tjarvi at qbang.org From d.herwald at onlinehome.de Thu Apr 6 15:19:55 2006 From: d.herwald at onlinehome.de (Dominik S. Herwald) Date: Thu, 06 Apr 2006 23:19:55 +0200 Subject: [Rxtx] USB Serialport - disconnection problems Message-ID: <443585FB.600@onlinehome.de> Hello! First of all: RXTX is a GREAT project! It works great for all my projects! Except for one issue... I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to serial convertors (FTDI FT232) with a Java Application. (Java 1.5.0_04) A usual serial port is not removeable from the PC of course, but a USB convertor like the FT232 can be disconnected at any time! And this is the Problem: When the FT232 is disconnected while the port is open, I get lots of Exceptions. Here the code excerpt where the exceptions are thrown: --------------------------------------------------------------------------------- public class RXTXComport extends Comport implements SerialPortEventListener { //... public void serialEvent(SerialPortEvent se) { int newData = 0; switch (se.getEventType()) { //... case SerialPortEvent.DATA_AVAILABLE: while (newData != -1) { try { newData = inputStream.read(); if (newData != -1) for(ComportListener listener : listeners) listener.charDataReady((char) newData); } catch (Exception e) { Global.syslog.logException(e, "Comport read error! Disconnected from target!"); Global.syslog.saveToLogFile(); } } break; } } //... } --------------------------------------------------------------------------------- These are the exceptions I get: --------------------------------------------------------------------------------- java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) java.io.IOException: No error in readByte at gnu.io.RXTXPort.readByte(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- ... goes on and on. If I close the port in the exception handling I get only one of the above exceptions followed by this one: --------------------------------------------------------------------------------- java.io.IOException: No error in nativeDrain at gnu.io.RXTXPort.nativeDrain(Native Method) at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124) at de.dsh.io.Comport.flush(Comport.java:144) at de.dsh.io.RXTXComport.close(RXTXComport.java:170) at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:244) at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) at gnu.io.RXTXPort.eventLoop(Native Method) at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) --------------------------------------------------------------------------------- I use my own Exception logger that logs every exception and other messages into a file... on the standard commandline appear some messages from the native code: --------------------------------------------------------------------------------- Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(2714): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(1468): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(482): Zugriff verweigert Error 0x5 at /home/bob/foo/tar/rxtx-2.1-7/build/.. --------------------------------------------------------------------------------- "Zugriff verweigert" = German for "Access denied" I cannot open any other port after this and need to close the Application. Any other operation on the serial ports causes the Application to freeze, which is not that nice... Any ideas how to solve this problem or to detect when the port is disconnected (and close the port)? I would try it myself - but I am not that deep into Win/Linux C programming... I use C for microcontrollers only... Thanks in advance and Best regards, Dominik S. Herwald http://www.dsh-elektronik.de/ From tjarvi at qbang.org Thu Apr 6 20:12:47 2006 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 6 Apr 2006 20:12:47 -0600 (MDT) Subject: [Rxtx] USB Serialport - disconnection problems In-Reply-To: <443585FB.600@onlinehome.de> References: <443585FB.600@onlinehome.de> Message-ID: On Thu, 6 Apr 2006, Dominik S. Herwald wrote: > Hello! > > First of all: RXTX is a GREAT project! > It works great for all my projects! > Except for one issue... > > I use the latest release 2.1.7-r2 on WinXP SP2 to use USB to > serial convertors (FTDI FT232) with a Java Application. > (Java 1.5.0_04) > > A usual serial port is not removeable from the PC of course, > but a USB convertor like the FT232 can be disconnected at any > time! > And this is the Problem: When the FT232 is disconnected while > the port is open, I get lots of Exceptions. > > Here the code excerpt where the exceptions are thrown: > --------------------------------------------------------------------------------- > public class RXTXComport extends Comport implements SerialPortEventListener > { > > //... > > public void serialEvent(SerialPortEvent se) > { > int newData = 0; > switch (se.getEventType()) > { > //... > case SerialPortEvent.DATA_AVAILABLE: > while (newData != -1) > { > try > { > newData = inputStream.read(); > if (newData != -1) > for(ComportListener listener : listeners) > listener.charDataReady((char) newData); > } > catch (Exception e) > { > Global.syslog.logException(e, > "Comport read error! Disconnected from > target!"); > Global.syslog.saveToLogFile(); > } > } > break; > } > } > > //... > > } > --------------------------------------------------------------------------------- > > > These are the exceptions I get: > > --------------------------------------------------------------------------------- > > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.io.IOException: No error in readByte > at gnu.io.RXTXPort.readByte(Native Method) > at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1250) > at de.dsh.io.RXTXComport.serialEvent(RXTXComport.java:222) > at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732) > at gnu.io.RXTXPort.eventLoop(Native Method) > at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575) > java.